﻿//////////////////////////////////////////////////////////////////////////////
//
// Copyright © 1998-2024 Glodon Company Limited.
//
// Licensed under the MIT License
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the “Software”),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//////////////////////////////////////////////////////////////////////////////
#pragma once

// std headers
#include <string>
#include <map>
#include <memory>
#include <vector>

// custom headers
#include "HomeDefines.h"


namespace gmepgcs
{
    class GCS_CORE_EXPORTS IParameterDefinition
    {
    public:
        explicit IParameterDefinition();
        virtual ~IParameterDefinition();

    public:
        bool operator==(const IParameterDefinition &other);
        bool operator!=(const IParameterDefinition &other);
        std::shared_ptr<IParameterDefinition> Clone();

    public:
        bool IsVisible()const;
        bool IsDeleteable()const;
        bool IsNameEditable()const;
        bool IsUnitEditable()const;
        bool IsInstanceEditable()const;
        //static const std::vector<std::pair<std::wstring, std::wstring>>& GetAvailableValueTypes();
        //static bool IsValidValueType(const std::wstring &valueType);
        bool IsGeometry()const;
        void SetIsGeometry(bool isGeometry);
        bool GetIsDrivingParameter()const;
        void SetIsDrivingParameter(bool isDrivingParameter);
        bool GetIsEssential()const;
        void SetIsEssential(bool isEssential);
        bool GetIsInstance()const;
        void SetIsInstance(bool isInstance);
        bool GetIsModifiable()const;
        void SetIsModifiable(bool isModifiable);
        bool GetIsOutputParameter()const;
        void SetIsOutputParameter(bool isOutputParameter);
        bool GetIsStandard()const;
        void SetIsStandard(bool isStandard);
        bool GetIsUserVisible()const;
        void SetIsUserVisible(bool isUserVisible);
        bool GetIsBuiltIn()const;
        void SetIsBuiltIn(bool isBuiltIn);
        bool GetIsShared()const;
        void SetIsShared(bool isShared);
        bool GetIsFromFile()const;
        void SetIsFromFile(bool isFromFile);
        const std::wstring& GetCode()const;
        void SetCode(const std::wstring& code);
        const std::wstring& GetDescription()const;
        void SetDescription(const std::wstring& description);
        const std::wstring& GetFormula()const;
        void SetFormula(const std::wstring& formula);
        const std::wstring& GetGroupName()const;
        void SetGroupName(const std::wstring& groupName);
        const std::wstring& GetGuid()const;
        void SetGuid(const std::wstring& guid);
        const std::wstring& GetId()const;
        void SetId(const std::wstring& id);
        const std::wstring& GetName()const;
        void SetName(const std::wstring& name);
        const std::wstring& GetParamType()const;
        void SetParamType(const std::wstring& paramType);
        const std::wstring& GetParameterDisplayType()const;
        void SetParameterDisplayType(const std::wstring& parameterDisplayType);
        const std::wstring& GetParameterType()const;
        void SetParameterType(const std::wstring& parameterType);
        const std::wstring& GetUnitSymbol()const;
        void SetUnitSymbol(const std::wstring& unitSymbol);
        const std::wstring& GetUnit()const;
        void SetUnit(const std::wstring& unit);
        const std::wstring& GetUnitCode()const;
        void SetUnitCode(const std::wstring& unitCode);
        const std::wstring& GetValueType()const;
        void SetValueType(const std::wstring& valueType);
        const std::map<std::wstring, std::wstring>&GetValues()const { return  m_Values; };
        std::map<std::wstring, std::wstring>&GetValues() { return  m_Values; };
    private:
        static std::vector<std::pair<std::wstring, std::wstring>> m_AvailableValueTypes;
        std::wstring m_Code;
        std::wstring  m_Formula;
        std::wstring  m_GroupName;
        std::wstring  m_Id;
        bool  m_IsDrivingParameter = false;
        bool  m_IsEssential = false;
        bool  m_IsGeometry = false;
        bool  m_IsInstance = false;
        bool  m_IsOutputParameter = false;
        bool  m_IsStandard = false;
        std::wstring  m_Name;
        std::wstring  m_ParameterDisplayType; // 可用值:Invalid,FollowUnitType,NoDisplay,Custom,Length,Area,Volume,Angle,Slope,Number,Text,Geometry,Density,YesOrNo,Float,Material,ValueList,StandardCodeReference,Count
        std::wstring  m_ParameterType; // 可用值: Invalid,None,Custom,Bool,Integer,Double,String,Coordinates,ElementId,BuildingStorey,Color,StandardCodeReference,Geometry,Count
        std::wstring  m_UnitSymbol;
        std::wstring  m_UnitCode;
        std::wstring  m_ValueType; // 可用值: String,Enum,Number,Logic,Int
        std::map<std::wstring, std::wstring>  m_Values;
        bool  m_IsBuiltIn = false;
        bool  m_IsShared = false;
        bool  m_IsFromFile = false;
        std::wstring m_Description;
        std::wstring m_Guid;
        std::wstring m_Unit;
        bool m_IsModifiable = false;
        bool m_IsUserVisible = false;
    };
}